package com.tongji.housediy.controller.designCMD
{
	import com.tongji.housediy.events.designEvent.GetDesignsByUserEvent;
	import com.tongji.housediy.model.DesignModel;
	import com.tongji.housediy.service.DesignService;
	
	import org.robotlegs.mvcs.Command;
	
	/**
	 * 
	 * @author yanghanbing
	 * 2011/4/20
	 */ 
	public class GetDesignsByUserCommand extends Command
	{
		[Inject]
		public var service:DesignService;
		
		[Inject]
		public var event:GetDesignsByUserEvent;
		
		[Inject]
		public var designModel:DesignModel;
		
		override public function execute():void
		{
			switch(event.type)
			{
				case GetDesignsByUserEvent.GET_DESIGNS_BY_USERID:
					service.getDesignsByUserID(event.userID, event.pageIndex, event.itemCount);
					break;
				case GetDesignsByUserEvent.UPDATE_DESIGN_MODEL:
					designModel.updateDesignModel(event.designArray);
					break;
			}
			
		}
	}
}